import numpy as np
import matplotlib.pyplot as plt

# 直方图表示了结果落于子区间的概率
IQ_list = [91,110,105,107,135,127,92,111,105,
           106,130,145,128,109,108,98,129,100,
           108,114,119,99,137,142,145,112,113]

IQ_A = np.array(IQ_list)  # 将Python列表转为numpy数组
# plt.hist(IQ_A)
# plt.title('IQ Distribution of Development Team.')
# plt.show()


A = np.random.standard_normal(200_0000)
A = A * 10 + 100  # 平均值100，标准差10
# B = np.histogram(A,50)[0]  # 将结果分散到50个桶里,取的第一个元素[0]是绘制的频数信息
B,X = np.histogram(A,50)
print(X)
X = (X[1:]+X[:-1])/2  # 使用桶的中点值而不是边缘值
print(X)
plt.plot(X,B)   # 联合使用频数和桶的值来绘制曲线
plt.show()


